<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="message"><br/>
        message:<h1 v-text="message"></h1>
        <h1 v-text="person.age"></h1>
        <button @click="add">点我</button>
    </div>


    <script src="../node_modules/vue/dist/vue.js"></script>
    <script type="text/javascript" >
    	let vm = new Vue({
            el:'#app',
            data:{
                message:'',
                person:{
                    id:10,
                    age:22,
                    name:'大米'
                }
            },methods:{
                add:function () {
                    this.person.age++;
                }
            },
            watch:{
                message(newVal,oldVal){
                    console.log('新的值'+newVal,'旧值'+oldVal);
                },
                person:{
                    deep:true,
                    handler(val){
                        console.log(val.age)
                    }
                }
            }
        });
    </script>
</body>
</html>